﻿using Avalon.Core;
using Avalon.Core.MVC;
using Avalon.Data.Models;
using System.Web.Routing;
using System.Linq;

namespace Avalon.UI
{
    // Note: For instructions on enabling IIS6 or IIS7 classic mode, 
    // visit http://go.microsoft.com/?LinkId=9394801

    public class MvcApplication : System.Web.HttpApplication
    {
        public override void Init()
        {
            base.Init();
            this.EndRequest += (s, e) =>
            {
                Avalon.Business.Initializer.ResetContext();
            };
        }

        protected void Application_Start()
        {
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            AvalonInitializer.Initialize();
            Business.Initializer.Initialize();
        }
    }
}